<script setup lang="ts">
import HmSon from './components/HmSon.vue'
let num: 0 | 1 = 0
const btn = (str: string): void => {
  console.log('子触发了父的方法', str)
}
const xxxfn = (n: 0 | 1): void => {
  console.log(n)
}
</script>

<template>
  <div>
    <h1>父组件</h1>
    <hr />
    <!-- 子传父方法名叫xxxfn 父方法也叫xxxfn  传入一个只能是0与1的数据到父方法并打印 -->
    <HmSon :num="num" @btn="btn" @xxxfn="xxxfn"></HmSon>
  </div>
</template>

<style scoped></style>
